<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class BuyChange implements ShouldBroadcast
{
  use Dispatchable, InteractsWithSockets, SerializesModels;

  public $seller_id;
  public $id;
  public $type;

  public function __construct($seller_id, $type = null, $id = null)
  {
    $this->id = $id;
    $this->seller_id = $seller_id;
    $this->type = $type;
  }

  public function broadcastOn()
  {
    return ["admin-channel", "seller-channel", 'member-channel', 'agent-channel'];
  }

  public function broadcastAs()
  {
    return 'buy-change';
  }
}
